//
//  ORComplexItem.m
//  OR_1
//
//  Created by Luboš Kulič on 10/15/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ORComplexItem.h"


@implementation XMLParserWorkerNamedData (ORComplexItem)

-(NSUInteger) numberOfValues {
	NSLog(@"ComplexItem numberOfValues");
	NSLog(@"ComplexItem: %@ subElCnt: %d, dataCnt: %d", elementName, [subelements count], [retData count]);
	
	return [subelements count] + [retData count];
}

-(NSString *) itemType {
	// should never be called
	return elementName; 
}


-(NSUInteger) numberOfDescriptionItems {
	//return 1;
	return [retData count];
}

-(NSString *) descriptionWithIndex:(id)index {
	NSLog(@"ComplexItem: %@ descriptionWithIndex: %@", elementName, index);
	// TODO
	return [[retData objectForKey:index] data];
}

-(id<DataItem>) valueWithIndex:(id)index {
	NSLog(@"ComplexItem: %@ valueWithIndex: %@", elementName, index);
	id val;	
	if (val = [retData objectForKey:index]) {
		return val;
	} else {
		return [subelements objectForKey:index]; // ????
	}
}


@end
